/**
 * Category Dao iBatis implementation
 */
package cn.tonyqiu.wonuly.dao.ibatis;

import java.util.List;

import cn.tonyqiu.wonuly.dao.CategoryDao;
import cn.tonyqiu.wonuly.model.Category;

/**
 * @author <a href="mailto:tony.qiu.smart@gmail.com">Tony Qiu</a>
 * 
 */
public class CategoryDaoiBatis extends GenericDaoiBatis<Category, Integer>
		implements CategoryDao {

	public CategoryDaoiBatis() {
		super(Category.class);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.tonyqiu.wonuly.dao.CategoryDao#getCategoriesByUserId(java.lang.Integer)
	 */
	@Override
	@SuppressWarnings("unchecked")
	public List<Category> getCategoriesByUserId(Integer userId) {
		return getSqlMapClientTemplate().queryForList("getCategoriesByUserId",
				userId);
	}

	/* (non-Javadoc)
	 * @see cn.tonyqiu.wonuly.dao.CategoryDao#getCategoryByCategoryName(java.lang.String)
	 */
	@Override
	public Category getCategoryByCategoryName(Category cateogyr) {
		return (Category)getSqlMapClientTemplate().queryForObject("getCategoryByCategoryName",cateogyr);
	}

}
